package com.ruoyi.common.core.enums;

import lombok.Getter;

/**
 * 是和否
 *
 * @author ruoyi
 */
@Getter
public enum DealFlagEnum {
  NOT(0, "未开始"),
  DEALING(1, "处理中"),
  FINISH(2, "已完成");

  /**
   * 编码 0 或者 1
   */
  private final int code;
  /**
   * 中文名
   */
  private final String name;

  DealFlagEnum(int code, String name) {
    this.code = code;
    this.name = name;
  }

  /**
   * 判断相等
   */
  public boolean eqCode(int code) {
    return this.code == code;
  }

  /**
   * 根据code获取枚举
   *
   * @param code 编码
   * @return 枚举对象
   */
  public static DealFlagEnum getByCode(int code) {
    if (code == 1) {
      return DEALING;
    }
    if (code == 2) {
      return FINISH;
    }
    return NOT;
  }


}
